home *** CD-ROM | disk | FTP | other *** search
- on PrintBitmap theCast
- if the castType of cast theCast <> #bitmap then
- alert("PrintBitmap can only print bitmapped castmembers.")
- exit
- end if
- if the machineType = 256 then
- set XObjFile to "pmatic.dll"
- else
- set XObjFile to "pmatic.xobj"
- end if
- openXLib(XObjFile)
- set printer to PrintOMatic(mnew)
- if not objectp(printer) then
- alert("There is no currently selected printer. Printing features are disabled.")
- else
- set pw to printer(mGetPageWidth)
- set ph to printer(mgetpageheight)
- set w to the width of cast theCast
- set h to the height of cast theCast
- set scaling to min(float(pw) / float(w), float(ph) / float(h))
- if (scaling < 1.0) and (w > h) then
- printer(mSetLandscapeMode, 1)
- set pw to printer(mGetPageWidth)
- set ph to printer(mgetpageheight)
- set scaling to min(float(pw) / float(w), float(ph) / float(h))
- end if
- set scaling to min(scaling, 1.0)
- set w to integer(w * scaling)
- set h to integer(h * scaling)
- set left to (pw - w) / 2
- set top to (ph - h) / 2
- printer(mNewPage)
- printer(mPicture, the picture of cast theCast, left, top, left + w, top + h)
- if printer(mDoJobSetup) = 1 then
- updateStage()
- printer(mPrint)
- end if
- printer(mdispose)
- end if
- closeXLib(XObjFile)
- end
-
- on min a, b
- if a < b then
- return a
- else
- return b
- end if
- end
-